package com.cloud.phone.http

import com.cloud.phone.constants.Constants
import com.efs.sdk.net.OkHttpInterceptor
import com.efs.sdk.net.OkHttpListener
import okhttp3.OkHttpClient
import retrofit2.Retrofit
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.converter.scalars.ScalarsConverterFactory

object CloudApi {
    private val cloudApi by lazy {
        val okHttpClient: OkHttpClient.Builder = BaseApi.getHttpClient()
        val retrofit = Retrofit.Builder()
            .baseUrl(Constants.BASE_URL)
            .addConverterFactory(GsonConverterFactory.create())
            .addConverterFactory(ScalarsConverterFactory.create())
            .addConverterFactory(GsonConverterFactory.create())
            .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
            .client(okHttpClient.build())
            .build()
        retrofit.create(ApiService::class.java)
    }
    fun getHttp():ApiService{
        return cloudApi
    }

}